package com.example.train_operate.ws.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.web.socket.WebSocketSession;

/**
 * @author 21609
 * 用户会话信息
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserSession {

    /**
     * 用户id
     */
    private String userId;

    /**
     * 房间id
     */
    private String roomId;

    /**
     * Websocket会话
     */
    private WebSocketSession session;

    /**
     * 客户端类型：web, android
     */
    private String clientType;

    /**
     * 加入房间时间
     */
    private long joinTime;

    public UserSession(String userId, String roomId, WebSocketSession session, String clientType){
        this.userId = userId;
        this.roomId = roomId;
        this.session = session;
        this.clientType = clientType;
        this.joinTime = System.currentTimeMillis();
    }
}
